/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codegen;

public class ParamDescr extends VarDescr {
	private boolean isVar;
	private VarDescr variable;
	private String name;

	public ParamDescr(String name, VarDescr var , boolean isVar) {
		super(var.getAddr(), var.typ, var.level);
		this.isVar = isVar;
		this.name = name;
	}
	
	/**
	 * Parameter müssen mit negativem Offset referenziert werden. 
	 * @return 
	 */
	@Override
	public int getAddr() {
		return -(addr + 1) - 2;
	}

	public String getName() {
		return name;
	}

	@Override
	public boolean isVar() {
		return isVar;
	}
	
	
	@Override
	public void print() {
		//throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	public String toString() {
		return "Param[" + ((isVar) ? "" : "!") + "VAR," + super.toString() + "]";
	}
}
